package zuoye.test2;

public class Test {
    public static void main(String[] args) {
        bread(new Dog("金毛","白","小花",3));
        bread(new Cat("小猫","黑","小黄",4));
        bread(new Hedgehog("小刺猬","绿","鸡鸡",5));

    }

    public static void bread(Animal a )
    {
        a.eat();
        if(a instanceof Dog)
        {
            Dog d = (Dog)a;
            d.lookHome();
        }
        else if(a instanceof Cat)
        {
            Cat c = (Cat)a;
            c.catchMouse();
        }
        else if(a instanceof Hedgehog)
        {
            Hedgehog h = (Hedgehog)a;
            h.actingCute();
        }

    }




}
